package com.dmitriyp.movie.dao;

import java.util.List;

import com.dmitriyp.movie.mapping.Movie;

/**
 * Interface represents abstraction for MovieManager.
 * 
 * @author Dmitriy
 * 
 */
public interface IMovieManager {

	/**
	 * Load Movie instance by id from a storage
	 * 
	 * @param movieId
	 *            - movie's id
	 * @return
	 */
	Movie get(int movieId);

	/**
	 * Add movie to a storage. Method returns saved movie instance. if movie is
	 * not persisted its id is supposed to be null
	 * 
	 * @param movie
	 *            - movie for saving
	 * @return
	 */
	Movie add(Movie movie);

	/**
	 * Save list of the movies to a storage. Returns movies that is saved
	 * successfully
	 * 
	 * @param movies
	 * @return
	 */
	List<Movie> addAll(List<Movie> movies);

	/**
	 * Delete movie by its id. Returns true if operation successfully
	 * 
	 * @param movieId
	 * @return
	 */
	boolean delete(int movieId);

	/**
	 * Delete movie instance from a stprage. Returns true if operation
	 * successfully
	 * 
	 * @param movie
	 * @return
	 */
	boolean delete(Movie movie);

	/**
	 * Retrieves all Movies ordered by some criteria.
	 * 
	 * @param orders
	 *            - defines Order of the movies
	 * @return
	 */
	List<Movie> listAll(Order... orders);

	/**
	 * Filters movies by title and returns them as a List
	 * 
	 * @param title
	 * @return
	 */
	List<Movie> filter(String title);

	/**
	 * Filters movies by star name and returns them as a List
	 * 
	 * @param star
	 * @return
	 */
	List<Movie> filterByStar(String star);

}
